//
//  ChangeViewController.m
//  UI_项目 测试1
//
//  Created by dlios on 15-1-17.
//  Copyright (c) 2015年 songCheng. All rights reserved.
//

#import "ChangeViewController.h"
#import "ChangeTableViewCell.h"
#import "ChangeViewController1.h"
#import "ChangeViewController2.h"
#import "ChangeViewController3.h"
#import "ChangeViewController4.h"
#import "MyViewController.h"
@interface ChangeViewController ()

@end

@implementation ChangeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    UIImage *image = [UIImage imageNamed:@"u=2668946273,312568733&fm=15&gp=0.jpg"];
//    
//    self.imageView1 = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen]bounds]];
//    
//    self.imageView1.image = image;
//    
//    [self.view addSubview:self.imageView1];
    self.navigationItem.title = @"编辑资料";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"iconfont-fanhui.png"] style:(UIBarButtonItemStylePlain) target:self action:@selector(Action1:)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"OK" style:(UIBarButtonItemStylePlain) target:self action:@selector(Action2:)];
    
    self.tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen]bounds] style:(UITableViewStyleGrouped)];
    
    //self.tableView.backgroundColor = [UIColor whiteColor];
    
    self.tableView.delegate = self;
    
    self.tableView.dataSource = self;
    
    [self.view addSubview:self.tableView];
    
    
    
    // Do any additional setup after loading the view.
}
- (void)Action1:(UIBarButtonItem *)button
{
    MyViewController *myView = [[MyViewController alloc] init];
    [myView setModalTransitionStyle:(UIModalTransitionStyleCoverVertical)];

//    [self presentViewController:tabBar animated:YES completion:nil];
//    [self presentViewController:MY animated:YES completion:^{
//        
//    }];
        [self dismissViewControllerAnimated:YES completion:^{
            
            
        }];
}
- (void)Action2:(UIBarButtonItem *)button
{
    MyViewController *myViewC = [[MyViewController alloc] init];
    
    [myViewC setModalTransitionStyle:(UIModalTransitionStyleFlipHorizontal)];
    
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
//    [self presentViewController:MY animated:YES completion:^{
//        
//    }];
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSMutableArray *array1 = [NSMutableArray arrayWithObjects:@"名字呦", @"简介呵", nil];
    
    NSMutableArray *array2 = [NSMutableArray arrayWithObjects: @"邮箱哒", @"手机吆", nil];
    
    static NSString *cell = @"reuse";
    
    ChangeTableViewCell *cellView = [[ChangeTableViewCell alloc] init];
    
    if (cellView == nil) {
        
        cellView = [[ChangeTableViewCell alloc] initWithStyle:(UITableViewCellStyleSubtitle) reuseIdentifier:cell];
    }
    if (indexPath.section == 0) {
        
        cellView.textLabel.text = [array1 objectAtIndex:indexPath.row];
        
        if (indexPath.row == 1) {
            
            cellView.detailTextLabel.text = @"最多300个字符哦";
            
        }
       
    }else if (indexPath.section == 1){
        
    cellView.textLabel.text = [array2 objectAtIndex:indexPath.row];
        
    cellView.detailTextLabel.text = @"验证后可以登录使用哦";
        
    }
    return cellView;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        
        if (indexPath.row == 0) {
            
            ChangeViewController1 *change1 = [[ChangeViewController1 alloc] init];
            
            [self.navigationController pushViewController:change1 animated:YES];
            
        }else if (indexPath.row == 1)
        {
            ChangeViewController2 *change2 = [[ChangeViewController2 alloc] init];
            
            [self.navigationController pushViewController:change2 animated:YES];
        
        }
        
    }else if (indexPath.section == 1)
        
    {
        if (indexPath.row == 0) {
            
            ChangeViewController3 *change3 = [[ChangeViewController3 alloc] init];
            
            [self.navigationController pushViewController:change3 animated:YES];
            
        }else if (indexPath.row == 1)
        {
            
            ChangeViewController4 *change4 = [[ChangeViewController4 alloc] init];
            
            [self.navigationController pushViewController:change4 animated:YES];
            
        }
    
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
